package com.example.demo;

import cn.hutool.crypto.GlobalBouncyCastleProvider;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello() {
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        return requestAttributes.toString();
    }

    @GetMapping("/test")
    public String test() {
        System.out.println("GlobalBouncyCastleProvider.INSTANCE = " + GlobalBouncyCastleProvider.INSTANCE);
        System.out.println("GlobalBouncyCastleProvider.INSTANCE.getProvider() = " + GlobalBouncyCastleProvider.INSTANCE.getProvider());
        GlobalBouncyCastleProvider.setUseBouncyCastle(true);
        System.out.println("GlobalBouncyCastleProvider.INSTANCE = " + GlobalBouncyCastleProvider.INSTANCE);
        System.out.println("GlobalBouncyCastleProvider.INSTANCE.getProvider() = " + GlobalBouncyCastleProvider.INSTANCE.getProvider());
        return "success";
    }

}
